﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace DailyReport.Controllers
{
    [Authorize]
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        [AllowAnonymous]
        [HttpPost("shutdown")]
        public void shutdown() {
            var semaphoreFilePath = Path.Combine(Directory.GetCurrentDirectory(), "keep-alive.txt");
            if (System.IO.File.Exists(semaphoreFilePath))
            {
                System.IO.File.Delete(semaphoreFilePath);
            }
        }
    }
}
